package org.ssssssss.magicapi.redis;

import java.util.HashMap;
import java.util.Map;

import javax.websocket.Session;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component
public class RedisReceiver {
	private static Logger logger = LoggerFactory.getLogger(RedisReceiver.class);
	
    public void handleMessage(String message, String topic) {
        logger.info("message:" + message + " ,topic: " + topic);
        if(Const.getMsgHandlerApi().length()>0) {
	        Map<String, Object> params = new HashMap<>();
	        params.put("msg", message);
	        params.put("topic", topic);
	        Const.getService().execute("POST",Const.getMsgHandlerApi(), params);        	
        }
    }
}
